package com.xdtech.trans.vo;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.sql.Timestamp;

import org.apache.commons.lang.StringUtils;

import com.xdtech.core.model.BaseItem;
import com.xdtech.core.orm.utils.BeanUtils;
import com.xdtech.trans.model.TransOrderTrack;

import com.xdtech.web.freemark.item.GridColumn;

/**
 * 
 * @author max.zheng
 * @create 2015-06-08 23:21:29
 * @since 1.0
 * @see
 */
public class TransOrderTrackItem extends BaseItem implements Serializable{
	private static final long serialVersionUID = 1L;
	private Long id;
	@GridColumn(title="运单号",width=100)
	private String orderNo;
	@GridColumn(title="跟踪时间",width=130)
	private String trackTime;
	@GridColumn(title="跟踪类型",width=100,dictionaryCode="TRACK_TYPE")
	private String trackType;
	@GridColumn(title="跟踪信息",width=400)
	private String trackInfo;
	
	private String goodsName;
	
	private String startWebsite;
	
	private String endWebsite;
	
	private String orderNos;

	public void setId(Long id) {
		this.id = id;
		addQuerys("id", id);
	}
	public Long getId() {
		return id;
	}
	
	public void setOrderNo(String orderNo) {
		this.orderNo = orderNo;
		addQuerys("orderNo", orderNo);
	}
	public String getOrderNo() {
		return orderNo;
	}
	
	public void setTrackType(String trackType) {
		this.trackType = trackType;
		addQuerys("trackType", trackType);
	}
	public String getTrackType() {
		return trackType;
	}
	
	public void setTrackInfo(String trackInfo) {
		this.trackInfo = trackInfo;
		addQuerys("trackInfo", trackInfo);
	}
	public String getTrackInfo() {
		return trackInfo;
	}
	
	public String getTrackTime()
	{
		return trackTime;
	}
	public void setTrackTime(String trackTime)
	{
		this.trackTime = trackTime;
		addQuerys("trackTime", trackTime);
	}
	public String getOrderNos()
	{
		return orderNos;
	}
	public void setOrderNos(String orderNos)
	{
		this.orderNos = orderNos;
		orderNos = orderNos.replace("XXX,", "");
		String[] orderArray = orderNos.split("\n");
		StringBuffer sb = new StringBuffer();
		for (String od : orderArray)
		{
			if (StringUtils.isNotBlank(od))
			{
				sb.append("'"+od.trim()+"',");
			}
			
		}
		if (sb.length()>0)
		{
			orderNos = sb.substring(0, sb.length()-1);
		}else {
			//避免空
			orderNos = "-1";
		}
		addQuerys("orderNos", orderNos);
	}
	/**
	 * 根据model构建vo
	 * 
	 * @author max
	 * @return
	 */
	public static TransOrderTrackItem createItem(TransOrderTrack transOrderTrack) {
		TransOrderTrackItem transOrderTrackItem = new TransOrderTrackItem();
		BeanUtils.copyProperties(transOrderTrackItem, transOrderTrack);
		//自定义属性设置填充
		return transOrderTrackItem;
	}
	/**
	 * 根据model集合创建vo集合
	 * 
	 * @author max
	 * @return
	 */
	public static List<TransOrderTrackItem> createItems(List<TransOrderTrack> transOrderTracks) {
		List<TransOrderTrackItem> transOrderTrackItems = new ArrayList<TransOrderTrackItem>();
		for (TransOrderTrack transOrderTrack : transOrderTracks) {
			transOrderTrackItems.add(createItem(transOrderTrack));
		}
		return transOrderTrackItems;
	}
	public String getGoodsName() {
		return goodsName;
	}
	public void setGoodsName(String goodsName) {
		this.goodsName = goodsName;
	}
	public String getStartWebsite() {
		return startWebsite;
	}
	public void setStartWebsite(String startWebsite) {
		this.startWebsite = startWebsite;
	}
	public String getEndWebsite() {
		return endWebsite;
	}
	public void setEndWebsite(String endWebsite) {
		this.endWebsite = endWebsite;
	}
}
